$(document).ready(function () {
    $("#btn_save").click(function () {
        $('#modify-form').bootstrapValidator('validate');
        var bootstrapValidator = $('#modify-form').data('bootstrapValidator');

        //表单验证通过
        if (bootstrapValidator.isValid()) {
            var userName = $("#userName").val().trim();
            var password = $("#password").val().trim();
            var newPassword = $("#newPassword").val().trim();
            $.post("loginController/modifyPassword", {
                userName: userName,
                password: password,
                newPassword: newPassword
            }, function (data) {
                if (data.tag == "1") {
                    alert("您的密码已成功修改!");
                } else {
                    alert("您输入的原密码不正确，请重新输入!");
                    $("#password").val("");
                    $("#newPassword").val("");
                }
                $("#modify-form").bootstrapValidator('resetForm', true);
            });
        }
    });

    $("#btn_reset").click(function () {
        $("#password").val("");
        $("#newPassword").val("");
        $("#modify-form").bootstrapValidator('resetForm', true);
    });

    <!-- =============================退出登录开始=============================-->
    $("#logout-button").click(function () {
        $.post("loginController/loginOut", {}, function (data) {
            window.location.href = "login.html";
        });
    });
    <!-- =============================退出登录结束=============================-->
});


